<link href="css/style.css" rel="stylesheet" type="text/css" />
<?php
if(!isset($_SESSION)) 
	{ 
		session_start(); 
	}
$user=$_SESSION['fullname'];
require_once('calendar/classes/tc_calendar.php');



if($_REQUEST['action']){
	$action=$_REQUEST['action'];
	$id=$_REQUEST['idapprovedoc'];
	if($_REQUEST['action']=="editform" || $_REQUEST['action']=="my_declined"){
		$sql="select Tile,Content,TripDate from approvedoc where IDApproveDoc='".$id."'";
		$mangnoidung= mysql_fetch_assoc(mysql_query($sql));
		$fromdate=$mangnoidung['TripDate'];
		$ftitle=$mangnoidung['Tile'];
		$fn222=$mangnoidung['Content'];
	}else if($_REQUEST['action']=="newform"){
		$fromdate=date("Y-m-d");
		$$ftitle=$mangnoidung[Tile];
		$fn222=$mangnoidung[Content];
	}
}

?>
<script type="text/javascript"
	src="admin/ckeditor_351/ckeditor.js"></script>
<script type="text/javascript"
	src="admin/ckfinder/ckfinder.js"></script>
<style>
.cke_contents {
	height: 400px !important;
	width: 100% !important;
}
a[title="Browse Server"]{
	display:none !important;
}
a[title="Duyệt trên máy chủ"]{
	display:none !important;
}
a[title="서버 보기"]{
	display:none !important;
}
a[title="Link"]{
	display:none !important;
}
a[title="Liên kết"]{
	display:none !important;
}
a[title="링크"]{
	display:none !important;
}
a[title="Advanced"]{
	display:none !important;
}
a[title="Tab mở rộng"]{
	display:none !important;
}
a[title="자세히"]{
	display:none !important;
}
tr td.cke_bottom{
	display:none !important;
}
</style>
<script type="text/javascript">
	$(document).ready(function() {
		  var editor = CKEDITOR.replace("n222",{language:"<?php $lang_current = $_SESSION['lang'];
if (isset($lang_current)) {
	if ($lang_current=='VN'){
		echo 'vi';
	}else if ($lang_current=='KR') {
		echo 'ko';
	}
	else{
		echo 'en';
	}
}
else{
	echo 'en';
} ?>", height:'100%', width:'100%'});
		    CKFinder.setupCKEditor(editor, 'admin/ckfinder') ;
	});
</script>	
<script  LANGUAGE="JavaScript" type="text/javascript">
function ch(status){
	$("#save").attr('disabled', 'disabled');
	$("#send").attr('disabled', 'disabled');
	$("#delete").attr('disabled', 'disabled');
	if(status!='Delete')
		if(document.f.title.value==""){
			alert('<?=$l_titlemusthavedate?>');
			document.f.title.focus();
			$("#save").removeAttr('disabled');
			$("#send").removeAttr('disabled');
			$("#delete").removeAttr('disabled');
			return 0;
		}
	return 1;
}

function focusOnMyInputBox(e,ten){
    var x;
    if(window.event) // IE8 and earlier
    	{
    	x=e.keyCode;
    	}
    else if(e.which) // IE9/Firefox/Chrome/Opera/Safari
    	{
    	x=e.which;
    	}
	if(x==13){
		document.getElementById(ten).focus();
		return false;
	}else{
		return true;
	}
}

function formSubmit(status)
{
	
	if(ch(status)!=0){
		document.getElementById("status").value=status;
		document.getElementById("frm1").submit();
	}
}
</script>

<script LANGUAGE="JavaScript" type="text/javascript">
// Popup window code
function newPopup(url) {
	popupWindow = window.open(
		url,'popUpWindow','height=500,width=600,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
}
</script>
<link	href="css/style.css" rel="stylesheet" type="text/css" />
<link	href="calendar/calendar.css" rel="stylesheet" type="text/css" />

<div class="title"></div>
<form method="post" id="frm1" name="f"
	action="newform-handle.php">
	<input type="hidden" name='type' value="<?=$type?>" />
	<input type="hidden" name='action' value="<?=$action?>" />
	<input type="hidden" name='status' id="status"/>
	<input type="hidden" name='id' value="<?=$id?>" />
	<div class="main_content" style="min-height: 895px">
		<ul class="top_but">
			<li>
			<?php if($action=="my_declined" || $action=="my_sending"){?>
				<a href="mydocument-list-mydocument-saved-content"><img src="images/back.png" alt="" /> </a>
			<?php }else{?>
				
			<?php if(isset($_REQUEST['page'])){?>
				<a href="<?=$_SERVER['HTTP_REFERER']?>&page=<?=$_REQUEST['page']?>"><img src="images/back.png" alt="" /> </a>
			<?php }else{?>
				<a href="<?=$_SERVER['HTTP_REFERER']?>"><img src="images/back.png" alt="" /> </a>
			<?php } 
			} ?>
			
			
				<p class="hidden" >
				<?=$l_back?>
				</p>
			</li>
			<li><input type="button" name="Save" value="" id="save"   onclick="formSubmit('Save')"
				style="background: url(images/save.png) no-repeat; width: 36px; height: 36px; border: none; position: absolute; top:0px; left:0px; right:0px; bottom:0px; margin: auto" />
				<p class="hidden">
				<?=$l_save?>
				</p></li>
			<li><input type="button" name="Send" value="" id="send" onclick="formSubmit('Send')"
				style="background: url(images/send.png) no-repeat; width: 36px; height: 36px; border: none; position: absolute; top:0px; left:0px; right:0px; bottom:0px; margin: auto" />
				<p class="hidden" >
				<?=$l_send_document?>
				</p></li>
			<?php 
			
				if($_REQUEST['action']){
					if($_REQUEST['action']=="editform" ){
						?>
						
						<li><input type="button" name="Delete" value="" onclick="formSubmit('Delete')" id='delete'
						style="background: url(images/deny.png) no-repeat; width: 36px; height: 36px; border: none; position: absolute; top:0px; left:0px; right:0px; bottom:0px; margin: auto" />
						<p class="hidden">
						<?=$l_delete?>
						</p></li>
						
						<?php 
					}
				}
			
			?>

		</ul>
		<table class="tcontent" cellpadding="5" cellspacing="0">
		<tr>
				<td class="col_left"><?php echo $l_title?></td>
				<td colspan="3"><input type="text" id="title" name="title"  value="<?php echo $ftitle?>"
					style="height: 24px; width: 100%; border: 1px solid #c4c0c9;line-height: 24px;" /></td>
			</tr>
			<tr>
				<td class="col_left" width="15%"><?php echo $_meetingdate?></td>
				<td><div align="left">
				<?php
				$myCalendar1 = new tc_calendar("date1", true);
				$myCalendar1->setIcon("calendar/images/iconCalendar.gif");
				$d=split('-',$fromdate,3);
					
				$myCalendar1->setDate($d[2],$d[1],$d[0]);
				$myCalendar1->setPath("calendar/");
				$myCalendar1->setYearInterval(2010, 2015);
				$myCalendar1->dateAllow('2010-01-01', '2015-12-31');
				//$myCalendar1->setHeight(350);
				//$myCalendar1->autoSubmit(true, "form1");
				//$myCalendar1->setSpecificDate(array("2011-04-01", "2011-04-13", "2011-04-25"), 0, 'month');
				$myCalendar1->setOnChange("myChanged('test')");
				//$myCalendar->rtl = true;
				$myCalendar1->writeScript();
					
				//echo $myCalendar1->getDate();

				?>
					</div></td>
			</tr>
			
			<tr>
				<td class="col_left"><?php echo $l_content?></td>
				<td colspan="3"></td>
			</tr>
			<tr>

				<td colspan="4" style="width:100%">
					<textarea rows="" cols="" id="n222" class="n222" name="n222"  style="width: 100%"><?php echo $fn222;?></textarea>
					<div align="left">
					<a  onkeydown="return CKEDITOR.tools.callFunction(0, 12, event);"
						 id=cke_21 class="cke_off cke_button_image"
						   title=Image role=button tabIndex=-1 aria-labelledby=cke_21_label
						   onclick="CKEDITOR.tools.callFunction(17, this); return false;" href="javascript:void('Image')" ? unselectable="on" 
						   >
							  <input class="buttonProject" type="button" style="margin: 5px 0;" value="Insert images" /> 
						  </a>
				</div>
				</td>

			</tr>
		</table>

	</div>

</form>
